<?php

/**
 * BoxRecord form base class.
 *
 * @method BoxRecord getObject() Returns the current form's model object
 *
 * @package    iEasy
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBoxRecordForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'box_record_id'  => new sfWidgetFormInputHidden(),
      'name'           => new sfWidgetFormInputText(),
      'image'          => new sfWidgetFormTextarea(),
      'link'           => new sfWidgetFormTextarea(),
      'comment'        => new sfWidgetFormTextarea(),
      'create_time'    => new sfWidgetFormDateTime(),
      'modify_time'    => new sfWidgetFormDateTime(),
      'hit_i'          => new sfWidgetFormInputText(),
      'system_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'add_empty' => true)),
      'news_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('News'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'box_record_id'  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('box_record_id')), 'empty_value' => $this->getObject()->get('box_record_id'), 'required' => false)),
      'name'           => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'image'          => new sfValidatorString(array('required' => false)),
      'link'           => new sfValidatorString(array('required' => false)),
      'comment'        => new sfValidatorString(array('required' => false)),
      'create_time'    => new sfValidatorDateTime(array('required' => false)),
      'modify_time'    => new sfValidatorDateTime(array('required' => false)),
      'hit_i'          => new sfValidatorInteger(array('required' => false)),
      'system_user_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'required' => false)),
      'news_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('News'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('box_record[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'BoxRecord';
  }

}
